﻿@{
    Layout = "_ConfigurePlugin";
}

@model Nop.Plugin.Shipping.Fedex.Models.FedexShippingModel
@using Nop.Plugin.Shipping.Fedex;

<form asp-controller="ShippingFedex" asp-action="Configure" method="post">
    <script type="text/javascript">
        $(document).ready(function () {
            $("#PackingType").change(togglePackingType);
            togglePackingType();
        });

        function togglePackingType() {
            var selectedPackingTypeId = $("#PackingType").val();
            if (selectedPackingTypeId == @(((int)PackingType.PackByDimensions).ToString())) {
                $('#pnlPassDimensions').show();
                $('#pnlPackingPackageVolume').hide();
            }
            else if (selectedPackingTypeId == @(((int)PackingType.PackByOneItemPerPackage).ToString())) {
                $('#pnlPassDimensions').hide();
                $('#pnlPackingPackageVolume').hide();
            }
            else if (selectedPackingTypeId == @(((int)PackingType.PackByVolume).ToString())) {
                $('#pnlPassDimensions').hide();
                $('#pnlPackingPackageVolume').show();
            }
        }
    </script>

    <div class="panel-group">
        <div class="panel panel-default">
            <div class="panel-body">
                <div class="form-group">
                    <div class="col-md-3">
                        <nop-label asp-for="Url" />
                    </div>
                    <div class="col-md-9">
                        <nop-editor asp-for="Url" />
                        <span asp-validation-for="Url"></span>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-3">
                        <nop-label asp-for="Key" />
                    </div>
                    <div class="col-md-9">
                        <nop-editor asp-for="Key" />
                        <span asp-validation-for="Key"></span>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-3">
                        <nop-label asp-for="Password" />
                    </div>
                    <div class="col-md-9">
                        <nop-editor asp-for="Password" />
                        <span asp-validation-for="Password"></span>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-3">
                        <nop-label asp-for="AccountNumber" />
                    </div>
                    <div class="col-md-9">
                        <nop-editor asp-for="AccountNumber" />
                        <span asp-validation-for="AccountNumber"></span>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-3">
                        <nop-label asp-for="MeterNumber" />
                    </div>
                    <div class="col-md-9">
                        <nop-editor asp-for="MeterNumber" />
                        <span asp-validation-for="MeterNumber"></span>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-3">
                        <nop-label asp-for="AvailableDropOffTypes" />
                    </div>
                    <div class="col-md-9">
                        <nop-select asp-for="DropoffType" asp-items="Model.AvailableDropOffTypes" />
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-3">
                        <nop-label asp-for="UseResidentialRates" />
                    </div>
                    <div class="col-md-9">
                        <nop-editor asp-for="UseResidentialRates" />
                        <span asp-validation-for="UseResidentialRates"></span>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-3">
                        <nop-label asp-for="ApplyDiscounts" />
                    </div>
                    <div class="col-md-9">
                        <nop-editor asp-for="ApplyDiscounts" />
                        <span asp-validation-for="ApplyDiscounts"></span>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-3">
                        <nop-label asp-for="AdditionalHandlingCharge" />
                    </div>
                    <div class="col-md-9">
                        <nop-editor asp-for="AdditionalHandlingCharge" />
                        <span asp-validation-for="AdditionalHandlingCharge"></span>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-3">
                        <nop-label asp-for="AvailableCarrierServices" />
                    </div>
                    <div class="col-md-9">
                        @foreach (var csd in Model.AvailableCarrierServices)
                        {
                            <div class="checkbox">
                                <label>
                                    <input type="checkbox" name="CheckedCarrierServices" value="@(csd)" checked="@Model.CarrierServicesOffered.Contains(csd)" />
                                    @csd
                                </label>
                            </div>
                        }
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-3">
                        <nop-label asp-for="PackingTypeValues" />
                    </div>
                    <div class="col-md-9">
                        <nop-select asp-for="PackingType" asp-items="Model.PackingTypeValues" />
                    </div>
                </div>
                <div class="form-group" id="pnlPassDimensions">
                    <div class="col-md-3">
                        <nop-label asp-for="PassDimensions" />
                    </div>
                    <div class="col-md-9">
                        <nop-editor asp-for="PassDimensions" />
                        <span asp-validation-for="PassDimensions"></span>
                    </div>
                </div>
                <div class="form-group" id="pnlPackingPackageVolume">
                    <div class="col-md-3">
                        <nop-label asp-for="PackingPackageVolume" />
                    </div>
                    <div class="col-md-9">
                        <nop-editor asp-for="PackingPackageVolume" />
                        <span asp-validation-for="PackingPackageVolume"></span>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-9 col-md-offset-3">
                        <input type="submit" name="save" class="btn bg-primary" value="@T("Admin.Common.Save")" />
                    </div>
                </div>
            </div>
        </div>
    </div>
</form>